package org.javaboy.demo.service;

import org.javaboy.demo.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    /**
     * 还需要跟 Spring 容器要一个 UserDao 回来
     *
     * @Autowired 注解就表示跟 Spring 容器去要一个 UserDao 回来，默认是按照类型去查找的。
     */
    @Autowired
    UserDao userDao;

//    @Autowired
//    public void setUserDao(UserDao userDao) {
//        this.userDao = userDao;
//    }

    public String sayHello() {
        return userDao.sayHello();
    }
}
